package ace.tool.generate.code.impl.resolver.scheme.resolver.core;

import ace.tool.generate.code.impl.resolver.scheme.constant.SchemaConstants;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.EntityClassInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.GraphqlAdminControllerClassInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.resources.GraphqlDtoFileInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.resources.GraphqlInputFileInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.test.graphql.TestGraphqlTestFileInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.test.graphql.TestGraphqlTestListFileInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.dto.ProjectInfo;
import lombok.Builder;
import lombok.RequiredArgsConstructor;

/**
 * @author caspar
 * @date 2023/11/17 10:34
 */
@Builder
@RequiredArgsConstructor
public class TestGraphqlTestGetFileListInfoResolver {
  private final ProjectInfo coreProjectInfo;
  private final EntityClassInfo entityClassInfo;
  private final GraphqlDtoFileInfo graphqlDtoFileInfo;
  private final GraphqlInputFileInfo graphqlInputFileInfo;
  private final GraphqlAdminControllerClassInfo graphqlAdminControllerClassInfo;

  public TestGraphqlTestListFileInfo resolve() {
    TestGraphqlTestFileInfo testGraphqlTestFileInfo =
        TestGraphqlTestFileInfo.builder()
            .testResourcesRootDir(coreProjectInfo.getTestResourcesRootDir())
            .entityClassInfo(entityClassInfo)
            .methodNameSuffix(SchemaConstants.GRAPHQL_ADMIN_CONTROLLER_GET_LIST_METHOD_SUFFIX)
            .graphqlDtoFileInfo(graphqlDtoFileInfo)
            .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
            .graphqlInputFileInfo(graphqlInputFileInfo)
            .build();

    return TestGraphqlTestListFileInfo.builder().info(testGraphqlTestFileInfo).build();
  }
}
